using System;
using System.Collections.Generic;
using System.Text;

namespace TVDesigner.Entities
{
    public class ImageFile
    {
        private string _Name;
        private string _FullName;
        private string _Extension;

        public ImageFile(string fileName)
        {
            if (fileName != null)
            {
                int lastIndex = fileName.LastIndexOf("\\");
                int lastDot = fileName.LastIndexOf(".");

                if (lastIndex >= 0)
                {
                    _Name = fileName.Substring(lastIndex+1, lastDot-lastIndex-1);
                    _Extension = fileName.Substring(lastDot+1);
                    _FullName = fileName;
                }
            }
        }

        public string FileNameWithExtension
        {
            get { return string.Concat(_Name, "." , _Extension); }
        }

        public string Extension
        {
            get { return _Extension; }
            set { _Extension = value; }
        }

        public string FullName
        {
            get { return _FullName; }
            set { _FullName = value; }
        }

        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            if (obj.GetType() != typeof(ImageFile))
                return false;

            ImageFile imageFile = obj as ImageFile;

            return _FullName.Equals(imageFile.FullName);
        }

    }
}
